package com.ddpt;

import com.springboot.starter.coderacademy.config.CoderAcademyService;
import org.apache.commons.lang3.StringUtils;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;

import javax.annotation.Resource;

@EnableDubbo
@EnableDiscoveryClient
@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@EnableAsync
@EnableScheduling
@MapperScan( {"com.ddpt.platform.mapper","com.lh.**.core.**.dao","com.lh.unimall.payment.dao"})
public class DemoApplication {


    static CoderAcademyService coderAcademyService;

    @Resource
    public void setCoderAcademyService(CoderAcademyService coderAcademyService) {
        DemoApplication.coderAcademyService = coderAcademyService;
    }

    public static void main(String[] args) {
        String property = System.getProperty("project.name");
        if(StringUtils.isBlank(property)){
            System.setProperty("project.name","Demo");
        }
        SpringApplication.run(DemoApplication.class, args);
        System.out.println("【Demo】服务启动完成");
        testCoderAcademy();
    }

    public static void testCoderAcademy(){
        System.out.println(coderAcademyService.connectDB());
    }

}
